/*
 * @Descripttion: 
 * @version: xxx
 * @Author: fuchengguo
 * @Date: 2020-07-16 21:21:07
 * @LastEditors: fuchengguo
 * @LastEditTime: 2021-03-30 04:48:10
 */
import dialog from './dialog.js';
import router from './router.js';
import config from '../config/config.js';
const auth = {
	getStorage(key) {
		const jsonString = uni.getStorageSync(key);
		console.log('jsonString', key, jsonString);
		if (jsonString) {
			try {

				return JSON.parse(jsonString)
			} catch (e) {
				return
			}
			console.log('8', 8);
		}

	},
	setStorage(params) {
		params.value = (typeof params.value === 'object') ? JSON.stringify(params.value) : params.value;
		params.key = params.key ? params.key : 'user';
		uni.setStorageSync(params.key, String(params.value));
		// window.localStorage.setItem(params.key, String(params.value));
		return true;
	},
	removeStorege(key) {
		if (typeof key === 'string') {
			uni.removeStorageSync(key);
		} else {
			key.forEach(item => {
				uni.removeStorageSync(item);

			})
		}
		return true;
	},
	clearStorage() {
		uni.clearStorageSync()
	},
	
}

export default auth;